<?php 
    $menu = trim($this->uri->segment(1));
    $CI =& get_instance();
?>
<div class="topurl">
        	<span class="left">
            	<a href="<?php echo base_url();?>"><b>Trang chủ</b></a>  &raquo; <a href="<?php echo base_url().($menu == 'lien-he' ? 'lien-he' : 'y-kien-khach-hang').'/'?>" class="current"><?php echo ($menu == 'lien-he' ? 'Liên hệ' : 'Ý kiến khách hàng');?></a>
            </span>
            
            <?php $this->load->view('layout/support_sell');?>
        </div>
        <div class="main-2">
        	<div class="b-contact">
            	<div class="bg-formsubmit">
                	<div class="title-form"><?php echo ($menu == 'lien-he' ? 'Liên hệ' : 'Ý kiến khách hàng');?></div>
                    <ul class="form-item13">
                         
                    	<?php
                          if($this->message->get("success")){
		                    echo $this->message->display("success");
		                  }
		                  if($this->message->get('error')){
		                  	echo $this->message->display("error");
		                  }   
		                  $fullname = array(
		                    'name'    =>  'txtName',
		                    'style'   =>  'width:90%;',
		                    'value'   =>  set_value('txtName')
		                  );		     
		                  $address = array(
		                    'name'    =>  'txtAddress',
		                    'style'   =>  'width:90%;',
		                    'value'   =>  set_value('txtAddress')
		                  );             
		                  $email = array(
		                    'name'    =>  'txtEmail',
		                    'style'   =>  'width:90%;',
		                    'value'   =>  set_value('txtEmail')
		                  );
		                  $phone = array(
		                    'name'    =>  'txtPhone',
		                    'style'   =>  'width:60%;',
		                    'value'   =>  set_value('txtPhone')
		                  );    
		                  $code_products = array(
		                    'name'    =>  'txtCodeProducts',
		                    'style'   =>  'width:96%;',
		                    'value'   =>  set_value('txtCodeProducts')
		                  );         
		                  $content = array(
		                    'name'    =>  'txtContent',
		                    'rows'    =>  '3',
		                    'cols'    =>  '20',
		                    'style'   =>   'width:90%'
		                  );
                          
                          $code = array(
		                    'name'    =>  'code',
		                    'style'   =>   'width:30%'
		                  );
		                  
		                  $i=0;
		                  if($this->message->get("success")){
		                    echo $this->message->display("success");
		                  }
		                  if($this->message->get('error')){
		                  	echo $this->message->display("error");
		                  }    
		                                   
		                  if(form_error($fullname['name']))
                          {       	                        		
                        	$fullname['style'] = 'border:solid 1px #ff0000; width:90%;';                        	
                  		  }
                  		  if(form_error($email['name']))
                          {       	                        		
                        	$email['style'] = 'border:solid 1px #ff0000; width:90%;';                        	
                  		  }
                  		  if(form_error($address['name']))
                          {       	                        		
                        	$address['style'] = 'border:solid 1px #ff0000; width:90%;';                        	
                  		  }
                  		  if(form_error($phone['name']))
                          {       	                        		
                        	$phone['style'] = 'border:solid 1px #ff0000; width:60%;';                        	
                  		  }
                  		  if(form_error($code_products['name']))
                          {       	                        		
                        	$code_products['style'] = 'border:solid 1px #ff0000; width:90%;';                        	
                  		  }
                  		  if(form_error($content['name']))
                          {       	                        		
                        	$content['style'] = 'border:solid 1px #ff0000; width:90%;';                        	
                  		  } 
                          if(form_error($code['name']))
                          {       	                        		
                        	$code['style'] = 'border:solid 1px #ff0000; width:30%;';                        	
                  		  }
                  		  
                  		  if(form_error($fullname['name']) || form_error($address['name']) || form_error($email['name']) || form_error($phone['name']) || form_error($code_products['name']) || form_error($content['name']) || form_error($code['name']))
                  		  {
                  		  	echo "<li class='error'><p>Có lỗi xảy ra! hãy kiểm tra lại các trường thông tin!</p></li>";
                  		  }
	                	?>
                		<?php echo form_open(base_url()."lien-he/");?>
                    	<li>
                        	<span class="left">Họ tên <font color="#ed1b24">*</font></span>
                            <span class="right">
                            	<?php echo form_input($fullname);?>
                            </span>
                        </li>
                        <li>
                        	<span class="left">Địa chỉ</span>
                            <span class="right">
                            	<?php echo form_input($address);?>
                            </span>
                        </li>
                        <li>
                        	<span class="left">Số điện thoại <font color="#ed1b24">*</font></span>
                            <span class="right">
                            	<?php echo form_input($phone);?>
                            </span>
                        </li>
                        <li>
                        	<span class="left">Email <font color="#ed1b24">*</font></span>
                            <span class="right">
                            	<?php echo form_input($email);?>
                            </span>
                        </li>
                        <li>
                        	<span class="left">Nội dung <font color="#ed1b24">*</font></span>
                            <span class="right">                            	
                            	<?php echo form_textarea($content,set_value($content['name']));?>
                            </span>
                        </li>
                        <li>
                        	<span class="left">Mã xác nhận<font color="#ed1b24" style="font-weight: bold;">&nbsp;<?php echo (isset($_SESSION['captcha_form_request']) ? $_SESSION['captcha_form_request'] : '');?></font></span>
                            <span class="right">                            	
                            	<?php echo form_input($code);?>
                            </span>
                        </li>
                        <li>
                        	<span class="left">&nbsp;</span>
                            <span class="right"><input type="submit" name="" value="Gửi thông tin" class="btnsend2" /></span>
                        </li>
                    </ul>
                    
                </div>                
            </div>
        </div>